package com.woniuxy.portal.runner;

import com.woniuxy.comon.BookConst;
import com.woniuxy.portal.service.BookService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class InitTopSaleRunner implements CommandLineRunner {

    @Autowired
    private BookService bookService;

    // 热销榜数据初始化
    @Override
    public void run(String... args) throws Exception {
        bookService.findTopSales(BookConst.FIRST_PAGE, BookConst.PAGE_SIZE);
        log.info("热销榜数据初始化完成");
    }
}